<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="author" content="">
<title></title>
<!--    <link href="assets/css/icons.css" rel="stylesheet"> -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/style.css" rel="stylesheet">
<!--     <link href="assets/css/responsive.css" rel="stylesheet"> -->

</head>

<body>



	<h2 class="header-title text-center" id="title">添加招聘详情</h2>
	<form id="recrParam">
		<input type="hidden" id="id" name="id">
		<table class="table">
			<tr>
				<td>姓名：</td>
				<td><input id="recrName" name="recrName"></td>
				<td>联系电话：</td>
				<td><input id="phone" name="phone"></td>
			</tr>
			<tr>
				<td>性别：</td>
				<td><select id="sex" name="sex">
						<option>男</option>
						<option>女</option>
				</select></td>
				<td>年龄：</td>
				<td><input id="age" name="age"></td>
			</tr>
			<tr>
				<td>出生日期：</td>
				<td><input id="birthday" name="birthday" readonly="readonly"></td>
				<td>应聘职位：</td>
				<td><input id="recruitJob" name="recruitJob"></td>
			</tr>
			<tr>
				<td>所学专业：</td>
				<td><input id="professional" name="professional"></td>
				<td>工作经验：</td>
				<td><input id="experience" name="experience"></td>
			</tr>
			<tr>
				<td>文化程度：</td>
				<td><select id="education" name="education">
						<option>专科</option>
						<option>本科</option>
						<option>硕士</option>
						<option>博士</option>
						<option>其他</option>
				</select></td>
				<td>登记时间：</td>
				<td><input id="registTime" name="registTime"
					readonly="readonly"></td>
			</tr>
			<tr>
				<td>毕业学校：</td>
				<td><input id="school" name="school"></td>
				<td>家庭住址：</td>
				<td><input id="homeAddr" name="homeAddr"></td>
			</tr>
			<tr>
				<td>个人简介：</td>
				<td colspan="3"><textarea id="remark" name="remark"
						style="width: 81%; overflow: auto;"></textarea></td>
			</tr>
		</table>
	</form>
	<div class="form-group">
		<input type="button" id="confirmRecr" value="确定"
			class="btn btn-primary btn-block"> <input type="button"
			id="returnDept" value="返回" class="btn btn-primary btn-block">
	</div>
	<script>
		$(function() {
			//日期插件
			laydate.render({
				elem : '#registTime' //指定元素
			});
			laydate.render({
				elem : '#birthday'
			});
			
			//数据校验
			checkData();
			
			
			//确认按钮
			$("#confirmRecr").click(function() {
				//校验数据
				$('#recrParam').bootstrapValidator('validate');
				if(!$('#recrParam').data('bootstrapValidator').isValid()){
					alert("校验失败")
					return;
				}
				if(!$("#registTime").val() || !$("#birthday").val()){
					alert("日期不能为空")
					return;
				}
				//序列化参数列表
				var params = $("#recrParam").serialize();
				//添加新的员工
				$.ajax({
					type : "get",
					url : "/HMS/addRecrInfo?" + params,
					dataType : 'json',
					contentType : "application/json;charset=UTF-8",
					success : function(value) {
						if (value.success == "OK") {
							// 							addTable();
							alert("操作成功");

						} else {
							//登陆失败
							alert("操作失败")
						}
					},
					error : function(data) {
						alert('连接失败');
					}
				});
			});
			//返回按钮
			$("#returnDept").click(function() {
				initRecr();
			});
		});
		
		function checkData(){
			$('#recrParam').bootstrapValidator({
			　　　　　message: '输入值错误，请重新输入',
			            　   feedbackIcons:{
			                　　　　　　　　valid: 'glyphicon glyphicon-ok',
			                　　　　　　　　invalid: 'glyphicon glyphicon-remove',
			                　　　　　　　　validating: 'glyphicon glyphicon-refresh'
			            　　　　　　　　   },
			            fields: {
			            	recrName : {
			                    message: '姓名验证失败',
			                    validators: {
			                        notEmpty: {
			                            message: '姓名不能为空'
			                        }
			                    }
			                },
			                phone : {
			                    message: '联系电话验证失败',
			                    validators: {
			                        notEmpty: {
			                            message: '联系电话不能为空'
			                        }
			                    }
			                },
			                age : {
			                    message: '年龄验证失败',
			                    validators: {
			                        notEmpty: {
			                            message: '年龄不能为空'
			                        },
			                        regexp: {
			                            regexp: /^\d+$/,
			                            message: '年龄只能是数字'
			                        }
			                    }
			                },
			                birthday : {
			                    message: '生日证失败',
			                    validators: {
			                        notEmpty: {
			                            message: '生日不能为空'
			                        }
			                    }
			                },
			                recruitJob : {
			                    message: '应聘职位证失败',
			                    validators: {
			                        notEmpty: {
			                            message: '应聘职位不能为空'
			                        }
			                    }
			                },
			                professional : {
			                    message: '专业验证失败',
			                    validators: {
			                        notEmpty: {
			                            message: '专业不能为空'
			                        }
			                    }
			                },
			                experience : {
			                    message: '工作经验验证失败',
			                    validators: {
			                        notEmpty: {
			                            message: '工作经验不能为空'
			                        }
			                    }
			                },
			                registTime : {
			                    message: '登记时间验证失败',
			                    validators: {
			                        notEmpty: {
			                            message: '登记时间不能为空'
			                        }
			                    }
			                },
			                school : {
			                    message: '毕业学校验证失败',
			                    validators: {
			                        notEmpty: {
			                            message: '毕业学校不能为空'
			                        }
			                    }
			                },
			            }
			        });
		}
		
	</script>
</body>

</html>
